package com.qinggeng.project.system.service.impl;

import com.qinggeng.common.enums.CommonEnum;
import com.qinggeng.common.utils.DateUtils;
import com.qinggeng.project.system.domain.Supplier;
import com.qinggeng.project.system.mapper.SupplierMapper;
import com.qinggeng.project.system.service.ISupplierService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SupplierServiceImpl implements ISupplierService {
    @Resource
    private SupplierMapper supplierMapper;
    @Override
    public int insertSupplier(Supplier supplier) {
        supplier.setStatus(CommonEnum.STATUS_10.getValue());
        supplier.setCreateTime(DateUtils.getNowDate());
        return supplierMapper.insertSupplier(supplier);
    }

    @Override
    public int deleteSupplierById(Long id) {
        return supplierMapper.deleteSupplierById(id);
    }

    @Override
    public int deleteSupplierByIds(Long[] ids) {
        return supplierMapper.deleteSupplierByIds(ids);
    }

    @Override
    public int updateSupplier(Supplier supplier) {
        return supplierMapper.updateSupplier(supplier);
    }

    @Override
    public List<Supplier> listSupplier(Supplier where) {
        return supplierMapper.listSupplier(where);
    }

    @Override
    public Supplier getSupplierById(Long id) {
        return supplierMapper.getSupplierById(id);
    }
}
